import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AgentpayOrderVO, AgentpayOrderForm, AgentpayOrderQuery } from '@/api/retail/agentpayOrder/types';

/**
 * 查询代付订单列表
 * @param query
 * @returns {*}
 */

export const listAgentpayOrder = (query?: AgentpayOrderQuery): AxiosPromise<AgentpayOrderVO[]> => {
  return request({
    url: '/retail/agentpayOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询代付订单详细
 * @param id
 */
export const getAgentpayOrder = (id: string | number): AxiosPromise<AgentpayOrderVO> => {
  return request({
    url: '/retail/agentpayOrder/' + id,
    method: 'get'
  });
};

/**
 * 新增代付订单
 * @param data
 */
export const addAgentpayOrder = (data: AgentpayOrderForm) => {
  return request({
    url: '/retail/agentpayOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改代付订单
 * @param data
 */
export const updateAgentpayOrder = (data: AgentpayOrderForm) => {
  return request({
    url: '/retail/agentpayOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除代付订单
 * @param id
 */
export const delAgentpayOrder = (id: string | number | Array<string | number>) => {
  return request({
    url: '/retail/agentpayOrder/' + id,
    method: 'delete'
  });
};
